package com.ruoyi.web.controller.interview;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.interview.domain.InterviewDimension;
import com.ruoyi.interview.domain.InterviewPosition;
import com.ruoyi.interview.domain.InterviewQuestion;
import com.ruoyi.interview.service.IInterviewDimensionService;
import com.ruoyi.interview.service.IInterviewPositionService;
import com.ruoyi.interview.service.IInterviewRecordService;
import com.ruoyi.interview.service.IQuestionGenerateService;
import com.ruoyi.web.util.ChatUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/interview/record")
public class InterviewRecordController {
    @Autowired
    private IInterviewRecordService interviewRecordService;

    /**
     * 开始面试
     * @param recodeId
     * @return
     */
    @GetMapping("/start")
    public AjaxResult startInterview(Long recodeId) {
        List<InterviewQuestion> list = interviewRecordService.start(recodeId);
        return AjaxResult.success(list);
    }

    /**
     * 结束面试并生成报告
     * @param recodeId
     * @return 报告JSON字符串
     */
    @GetMapping("/finish")
    public AjaxResult finishInterview(Long recodeId) {
        String reportJson = interviewRecordService.finish(recodeId);
        return AjaxResult.success(reportJson);
    }
}
